/* NOTICE
 
    Jim - the Java Image Manager, copyright (c) 2005 - 2007 Grant Gardner 
 
    Jim is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Jim is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
    In addition, as a special exception, you are permitted to link this code
    with the 3rd party libraries required to compile this file and to
    distribute a linked combination including them. You must obey the
    GNU General Public License in all respects for all of the code except for
    those 3rd party libraries that are licenced under terms incompatible with the
    GNU General Public License.  
 
 
 NOTICE */

package au.com.lastweekend.jim.io.exif.makernote.minolta;

import java.text.DateFormat;
import java.text.DecimalFormat;
import java.util.GregorianCalendar;

import au.com.lastweekend.jim.io.metadata.Directory;
import au.com.lastweekend.jim.io.metadata.MetadataException;
import au.com.lastweekend.jim.io.metadata.AbstractTagDescriptor;
import au.com.lastweekend.jim.util.Rational;

/**
 * 
 * Descriptor for encoded Minolta camera settings. Derived from Dalibor's info at www.dalibor.cz
 * 
 * @version $Id: MinoltaCameraSettingsDescriptor.java,v 1.2 2005/06/09 11:15:38 ggardner Exp $
 * @author <a href="mailto:grant@lastweekend.com.au"> <Grant Gardner> </a>
 */
public class MinoltaCameraSettingsDescriptor extends AbstractTagDescriptor {

    /**
     * @param directory
     */
    public MinoltaCameraSettingsDescriptor(Directory directory) {

        super(directory);
    }

    /**
     * 
     * @see au.com.lastweekend.jim.io.metadata.AbstractTagDescriptor#getDescription(int)
     */
    public String getDescription(int tagType) throws MetadataException {

        switch (tagType) {
            case MinoltaCameraSettingsDirectory.TAG_EXPOSURE_MODE :
                return getExposureModeDescription();
            case MinoltaCameraSettingsDirectory.TAG_FLASH_MODE :
                return getFlashModeDescription();
            case MinoltaCameraSettingsDirectory.TAG_WHITE_BALANCE :
                return getWhiteBalanceDescription();
            case MinoltaCameraSettingsDirectory.TAG_IMAGE_SIZE :
                return getImageSizeDescription();
            case MinoltaCameraSettingsDirectory.TAG_CAMERA_MODEL :
                return getCameraModelDescription();
            case MinoltaCameraSettingsDirectory.TAG_IMAGE_QUALITY :
                return getImageQualityDescription();
            case MinoltaCameraSettingsDirectory.TAG_DRIVE_MODE :
                return getDriveModeDescription();
            case MinoltaCameraSettingsDirectory.TAG_METERING_MODE :
                return getMeteringModeDescription();
            case MinoltaCameraSettingsDirectory.TAG_FILM_SPEED :
                return getFilmSpeedDescription();
            case MinoltaCameraSettingsDirectory.TAG_SHUTTER_SPEED :
                return getShutterSpeedDescription();
            case MinoltaCameraSettingsDirectory.TAG_APERTURE :
            case MinoltaCameraSettingsDirectory.TAG_MAX_APERTURE :
                return getApertureDescription(tagType);
            case MinoltaCameraSettingsDirectory.TAG_MACRO_MODE :
            case MinoltaCameraSettingsDirectory.TAG_FILE_NUMBER_MEMORY :
            case MinoltaCameraSettingsDirectory.TAG_INTERVAL_MODE :
            case MinoltaCameraSettingsDirectory.TAG_INTERNAL_FLASH :
                return getOnOffDescription(tagType);
            case MinoltaCameraSettingsDirectory.TAG_WHITE_BALANCE_RED :
            case MinoltaCameraSettingsDirectory.TAG_WHITE_BALANCE_GREEN :
            case MinoltaCameraSettingsDirectory.TAG_WHITE_BALANCE_BLUE :
                return getWhiteBalanceCoefficientDescription(tagType);
            case MinoltaCameraSettingsDirectory.TAG_DIGITAL_ZOOM :
                return getDigitalZoomDescription();
            case MinoltaCameraSettingsDirectory.TAG_EXPOSURE_COMPENSATION :
                return getExposureCompensationDescription();
            case MinoltaCameraSettingsDirectory.TAG_BRACKET_STEP :
                return getBracketStepDescription();
            case MinoltaCameraSettingsDirectory.TAG_FOCAL_LENGTH :
                return getFocalLengthDescription();
            case MinoltaCameraSettingsDirectory.TAG_FOCUS_DISTANCE :
                return getFocusDistanceDescription();
            case MinoltaCameraSettingsDirectory.TAG_DATE :
                return getDateDescription();
            case MinoltaCameraSettingsDirectory.TAG_TIME :
                return getTimeDescription();
            case MinoltaCameraSettingsDirectory.TAG_SATURATION :
            case MinoltaCameraSettingsDirectory.TAG_CONTRAST :
            case MinoltaCameraSettingsDirectory.TAG_COLOUR_FILTER :
                return getCompensationDescription(tagType);
            case MinoltaCameraSettingsDirectory.TAG_SUBJECT_PROGRAM :
                return getSubjectProgramDescription();
            case MinoltaCameraSettingsDirectory.TAG_SHARPNESS :
                return getSharpnessDescription();
            case MinoltaCameraSettingsDirectory.TAG_FLASH_COMPENSATION :
                return getFlashCompensationDescription();
            case MinoltaCameraSettingsDirectory.TAG_ISO_SETTING :
                return getISOSettingDescription();
            case MinoltaCameraSettingsDirectory.TAG_COLOUR_MODE :
                return getColourModeDescription();
            case MinoltaCameraSettingsDirectory.TAG_FOLDER_NAME :
                return getFolderNameDescription();
            case MinoltaCameraSettingsDirectory.TAG_BRIGHTNESS_VALUE :
                return getBrightnessValueDescription();
            case MinoltaCameraSettingsDirectory.TAG_WIDE_FOCUS_ZONE :
                return getWideFocusZoneDescription();
            case MinoltaCameraSettingsDirectory.TAG_COLOUR_PROFILE :
                return getColourProfileDescription();
            case MinoltaCameraSettingsDirectory.TAG_DEC_POSITION :
                return getDECPositionDescription();
            case MinoltaCameraSettingsDirectory.TAG_FOCUS_AREA :
                return getFocusAreaDescription();
            case MinoltaCameraSettingsDirectory.TAG_FOCUS_MODE :
                return getFocusModeDescription();
            default :
                return getDirectory().getString(tagType);
        }
    }

    /**
     * @return
     */
    private String getFocusModeDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_FOCUS_MODE)) {
            return null;
        }
        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_FOCUS_MODE);
        switch (tagValue) {
            case 0 :
                return "Auto Focus";
            case 1 :
                return "Manual Focus";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getFocusAreaDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_FOCUS_AREA)) {
            return null;
        }
        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_FOCUS_AREA);
        switch (tagValue) {
            case 0 :
                return "Wide";
            case 1 :
                return "Spot";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getDECPositionDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_DEC_POSITION)) {
            return null;
        }
        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_DEC_POSITION);
        switch (tagValue) {

            case 0 :
                return "Exposure";
            case 1 :
                return "Contrast";
            case 2 :
                return "Saturation";
            case 3 :
                return "Filter";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getColourProfileDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_COLOUR_PROFILE)) {
            return null;
        }
        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_COLOUR_PROFILE);
        switch (tagValue) {
            case 0 :
                return "Not embedded";
            case 1 :
                return "Embedded";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getWideFocusZoneDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_WIDE_FOCUS_ZONE)) {
            return null;
        }
        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_WIDE_FOCUS_ZONE);
        switch (tagValue) {
            case 0 :
                return "None";
            case 1 :
                return "Centre (horizontal)";
            case 2 :
                return "Centre (vertical)";
            case 3 :
                return "Left";
            case 4 :
                return "Right";
            default : // do nothing
        }
        return null;
    }

    /*
     * 
     * 0 - no zone 1 - center zone (horizontal orientation) 2 - center zone (vertical orientation) 3 - left zone 4 - right zone
     */
    /**
     * @return
     */
    private String getBrightnessValueDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_BRIGHTNESS_VALUE)) {
            return null;
        }

        double tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_BRIGHTNESS_VALUE);
        double bv = Math.pow(2.0, ((tagValue / 8.0) - 6.0));

        return ((int) bv) + "";

    }

    /**
     * @return
     */
    private String getFolderNameDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_FOLDER_NAME)) {
            return null;
        }
        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_FOLDER_NAME);
        switch (tagValue) {
            case 0 :
                return "Standard";
            case 1 :
                return "Data format";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getColourModeDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_COLOUR_MODE)) {
            return null;
        }
        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_COLOUR_MODE);
        switch (tagValue) {
            case 0 :
                return "Natural color";
            case 1 :
                return "Black&White";
            case 2 :
                return "Vivid color";
            case 3 :
                return "Solarization";
            case 4 :
                return "AdobeRGB";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getISOSettingDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_ISO_SETTING)) {
            return null;
        }
        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_ISO_SETTING);
        switch (tagValue) {
            case 0 :
                return "100";
            case 1 :
                return "200";
            case 2 :
                return "400";
            case 3 :
                return "800";
            case 4 :
                return "Auto";

            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getFlashCompensationDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_FLASH_COMPENSATION)) {
            return null;
        }

        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_FLASH_COMPENSATION);
        Rational rational = new Rational(tagValue - 6, 3);
        return rational.toSimpleString(false);
    }

    /**
     * @return
     */
    private String getSharpnessDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_SHARPNESS)) {
            return null;
        }
        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_SHARPNESS);
        switch (tagValue) {
            case 0 :
                return "Hard";
            case 1 :
                return "Normal";
            case 2 :
                return "Soft";
            default : // do nothing

        }
        return null;
    }

    /**
     * @return
     */
    private String getSubjectProgramDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_SUBJECT_PROGRAM)) {
            return null;
        }

        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_SUBJECT_PROGRAM);
        switch (tagValue) {
            case 0 :
                return "None";
            case 1 :
                return "Portrait";
            case 2 :
                return "Text";
            case 3 :
                return "Night portrait";
            case 4 :
                return "Sunset";
            case 5 :
                return "Sports action";
            default : // do nothing
        }
        return null;
    }

    /**
     * @param tagType
     * @return -3 <->+3
     */
    private String getCompensationDescription(int tagType) throws MetadataException {

        if (!getDirectory().containsTag(tagType)) {
            return null;
        }

        int tagValue = getDirectory().getInt(tagType);
        return tagValue - 3 + "";

    }

    /**
     * @return
     */
    private String getTimeDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_TIME)) {
            return null;
        }

        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_TIME);
        int hour = tagValue / 65536;
        int minute = tagValue / 256 - (hour * 256);
        int second = tagValue % 256;

        DateFormat timeFormat = DateFormat.getTimeInstance();
        GregorianCalendar calendarDate = new GregorianCalendar(1900, 1, 1, hour, minute, second);

        return timeFormat.format(calendarDate.getTime());
    }

    /**
     * @return
     */
    private String getDateDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_DATE)) {
            return null;
        }

        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_DATE);
        int year = tagValue / 65536;
        int month = tagValue / 256 - (year * 256);
        int day = tagValue % 256;

        DateFormat dateFormat = DateFormat.getDateInstance();
        GregorianCalendar calendarDate = new GregorianCalendar(year, month - 1, day);
        return dateFormat.format(calendarDate.getTime());
    }

    /**
     * @return
     */
    private String getFocusDistanceDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_FOCUS_DISTANCE)) {
            return null;
        }

        double tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_FOCUS_DISTANCE);
        double focusDistance = tagValue / 1000.0;

        DecimalFormat formatter = new DecimalFormat("0.00");
        return formatter.format(focusDistance) + "m";

    }

    /**
     * @return
     */
    private String getFocalLengthDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_FOCAL_LENGTH)) {
            return null;
        }

        double tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_FOCAL_LENGTH);

        double focalLength = tagValue / 256.0;
        double focalLength35mm = focalLength * 3.9333;
        DecimalFormat formatter = new DecimalFormat("0.00");
        return formatter.format(focalLength) + "mm (" + formatter.format(focalLength35mm) + "mm)";

    }

    /**
     * @return
     */
    private String getBracketStepDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_BRACKET_STEP)) {
            return null;
        }

        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_BRACKET_STEP);
        switch (tagValue) {
            case 0 :
                return "1/3 ev";
            case 1 :
                return "2/3 ev";
            case 2 :
                return "1 ev";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getExposureCompensationDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_DIGITAL_ZOOM)) {
            return null;
        }

        double tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_DIGITAL_ZOOM);
        double expComp = tagValue / 3.0 - 2.0;
        DecimalFormat formatter = new DecimalFormat("0.0");

        return formatter.format(expComp) + " ev";

    }

    /**
     * @param tagType
     * @return
     */
    private String getDigitalZoomDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_DIGITAL_ZOOM)) {
            return null;
        }

        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_DIGITAL_ZOOM);
        switch (tagValue) {
            case 0 :
                return "Off";
            case 1 :
                return "Digital magnification used";
            case 2 :
                return "Digital zoom 2x";
            case 3 :
                return "?????";
            default : // do nothing
        }
        return null;
    }

    /**
     * @param tagType
     * @return
     */
    private String getWhiteBalanceCoefficientDescription(int tagType) throws MetadataException {

        if (!getDirectory().containsTag(tagType)) {
            return null;
        }

        double tagValue = getDirectory().getInt(tagType);
        DecimalFormat formatter = new DecimalFormat("0.00");

        return formatter.format(tagValue / 256.0);
    }

    /**
     * @param tagType
     * @return
     */
    private String getOnOffDescription(int tagType) throws MetadataException {

        if (!getDirectory().containsTag(tagType)) {
            return null;
        }

        int tagValue = getDirectory().getInt(tagType);

        switch (tagValue) {
            case 0 :
                return "Off";
            case 1 :
                return "On";
            default :
                return null;
        }
    }

    /**
     * @return
     */
    private String getApertureDescription(int tagType) throws MetadataException {

        if (!getDirectory().containsTag(tagType)) {
            return null;
        }

        int tagValue = getDirectory().getInt(tagType);

        /*
         * ApertureValue = x/8-1 Aperture = 2^( x/16-0.5 )
         */

        double fStop = Math.pow(2.0, ((double) tagValue) / 16.0 - 0.5);
        DecimalFormat formatter = new DecimalFormat("0.#");
        return "F" + formatter.format(fStop);

    }

    /**
     * @return
     */
    private String getShutterSpeedDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_SHUTTER_SPEED)) {
            return null;
        }

        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_SHUTTER_SPEED);

        /*
         * Time value = x/8-6 ShutterSpeed = 2^( (48-x)/8 )
         */

        // double timeValue = (((double) tagValue) / 8.0) - 6;
        double shutterSpeed = Math.pow(2.0, (48.0 - ((double) tagValue)) / 8.0);

        if (shutterSpeed < 1) {
            return "1/" + ((int) (1.0 / shutterSpeed)) + " secs";
        } else {
            return ((int) shutterSpeed) + " secs: ";
        }

    }

    /**
     * @return
     */
    private String getFilmSpeedDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_FILM_SPEED)) {
            return null;
        }

        /*
         * Speed value = x/8-1 ISO = (2^(x/8-1))*3.125
         */
        int tagValue = getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_FILM_SPEED);

        double speedValue = (((double) tagValue) / 8.0) - 1.0;
        int isoValue = (int) (Math.pow(2.0, speedValue) * 3.125);

        return isoValue + " ASA";
    }

    /**
     * @return
     */
    private String getMeteringModeDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_METERING_MODE)) {
            return null;
        }

        switch (getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_METERING_MODE)) {
            case 0 :
                return "Multi-segment";
            case 1 :
                return "Center weighted";
            case 2 :
                return "Spot";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getDriveModeDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_DRIVE_MODE)) {
            return null;
        }

        switch (getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_DRIVE_MODE)) {

            case 0 :
                return "single";
            case 1 :
                return "continuous";
            case 2 :
                return "self-timer";
            case 4 :
                return "bracketing";
            case 5 :
                return "interval";
            case 6 :
                return "UHS continuous";
            case 7 :
                return "HS continuous";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getImageQualityDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_IMAGE_QUALITY)) {
            return null;
        }

        switch (getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_IMAGE_QUALITY)) {

            case 0 :
                return "Raw";
            case 1 :
                return "Superfine";
            case 2 :
                return "Fine";
            case 3 :
                return "Standard";
            case 4 :
                return "Economy";
            case 5 :
                return "Extra fine";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getCameraModelDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_CAMERA_MODEL)) {
            return null;
        }

        switch (getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_CAMERA_MODEL)) {
            case 0 :
                return "DiMAGE 7";
            case 1 :
                return "DiMAGE 5";
            case 2 :
                return "DiMAGE S304";
            case 3 :
                return "DiMAGE S404";
            case 4 :
                return "DiMAGE 7i";
            case 5 :
                return "DiMAGE 7Hi";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getImageSizeDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_IMAGE_SIZE)) {
            return null;
        }

        switch (getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_IMAGE_SIZE)) {
            case 0 :
                if (getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_CAMERA_MODEL) == 5) {
                    return "2048 x 1536";
                } else {
                    return "2560 x 1920";
                }
            case 1 :
                return "1600 x 1200";
            case 2 :
                return "1280 x 960";
            case 3 :
                return "640 x 480";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getWhiteBalanceDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_WHITE_BALANCE)) {
            return null;
        }

        switch (getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_WHITE_BALANCE)) {
            case 0 :
                return "Auto";
            case 1 :
                return "Daylight";
            case 2 :
                return "Cloudy";
            case 3 :
                return "Tungsten";
            case 5 :
                return "Custom";
            case 7 :
                return "Fluorescent";
            case 8 :
                return "Fluorescent 2";
            case 11 :
                return "Custom 2";
            case 12 :
                return "Custom 3";
            default : // do nothing
        }
        return null;
    }

    /**
     * @return
     */
    private String getFlashModeDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_FLASH_MODE)) {
            return null;
        }
        /*
         * 0 - fill-flash 1 - red-eye reduction 2 - rear flash sync 3 - wireless
         * 
         */
        switch (getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_FLASH_MODE)) {
            case 0 :
                return "Fill-flash";
            case 1 :
                return "Red-eye reduction";
            case 2 :
                return "Rear flash sync";
            case 3 :
                return "Wireless";
            default :
                return null;
        }
    }

    /**
     * @return
     */
    private String getExposureModeDescription() throws MetadataException {

        if (!getDirectory().containsTag(MinoltaCameraSettingsDirectory.TAG_EXPOSURE_MODE)) {
            return null;
        }
        /*
         * 0 - P mode 1 - A mode 2 - S mode 3 - M mode
         */
        switch (getDirectory().getInt(MinoltaCameraSettingsDirectory.TAG_EXPOSURE_MODE)) {
            case 0 :
                return "Program Mode";
            case 1 :
                return "Aperture Priority";
            case 2 :
                return "Shutter Priority";
            case 3 :
                return "Manual";
            default : // do nothing
        }
        return null;
    }

    @Override
    public boolean isTagUpdateable(int tagType) {

        return false;
    }

}